#ifndef NetState_H
#define NetState_H

#include <Ogre.h>

#include "NetConsole.h"
#include "GameState.h"

class NetState : public GameState
{
public:
	void enter();
	void exit();

	void pause();
	void resume();

	bool keyPressed(const OIS::KeyEvent &arg);
	bool keyReleased(const OIS::KeyEvent &arg);

	bool mouseMoved( const OIS::MouseEvent &arg );
	bool mousePressed( const OIS::MouseEvent &arg, OIS::MouseButtonID id );
	bool mouseReleased( const OIS::MouseEvent &arg, OIS::MouseButtonID id );

	bool frameStarted(const Ogre::FrameEvent& evt);
	bool frameEnded(const Ogre::FrameEvent& evt);

	void createScene();
	void setupEventHandlers();
	bool handleQuit(const CEGUI::EventArgs& e);
	//bool handlePlay(const CEGUI::EventArgs& e);
	bool handleCreate(const CEGUI::EventArgs& e);
	bool handleConnect(const CEGUI::EventArgs& e);
	bool handleStart(const CEGUI::EventArgs& e);
	bool handleText(const CEGUI::EventArgs& e);
	bool handleIP(const CEGUI::EventArgs& e);
	bool handleSend(const CEGUI::EventArgs& e);

	static NetState* getInstance() { return &mNetState; }

protected:
	NetState() {}

	Ogre::Root *mRoot;
	Ogre::SceneManager* mSceneMgr;
	Ogre::Viewport* mViewport;
	DeviceManager* mDeviceManager;
	GUIManager* mGUIManager;
	OIS::Keyboard* mKeyboard;
	OIS::Mouse* mMouse;
	Ogre::Camera* mCamera;
	bool mExitGame;
	bool mGoToPlay;
	bool mCreate;
	bool mConnect;
	bool mStart;
	bool mIP;
	NetConsole *conn;

private:
	static NetState mNetState;
};

#endif